<template>
    <!-- :close-on-click-modal="false" //禁用点击空白区域
    :close-on-press-escape="false" //禁用ESC键 -->
    <el-dialog
      title="详细信息"
      :close-on-press-escape="false" 
      :close-on-click-modal="false"
      :append-to-body="true"
      :lock-scroll="true"
      :visible.sync="visible">
  
  
      <el-form  
      label-position="right"  label-width="150px"
      status-icon
      size="small"
      :model="dataForm"  ref="dataForm">
        <el-form-item label="指导记录id" prop="recordsId">
          {{ dataForm.recordsId}}
          <!-- <el-input v-model="dataForm.cgyType"  placeholder="密码"></el-input> -->
        </el-form-item>
        <el-form-item label="指导教师职工号" prop="prospect">
          {{ dataForm.reTeacher }}
          <!-- <el-input v-model="dataForm.cgySource" placeholder="确认密码"></el-input> -->
        </el-form-item>
        <el-form-item label="学生姓名" prop="prospect">
          {{ dataForm.name }}
          <!-- <el-input v-model="dataForm.cgySource" placeholder="确认密码"></el-input> -->
        </el-form-item>
        <el-form-item label="学院" prop="prospect">
          {{ dataForm.department }}
          <!-- <el-input v-model="dataForm.cgySource" placeholder="确认密码"></el-input> -->
        </el-form-item>
        <el-form-item label="对指导老师建议" prop="plan">
          <el-input v-model="dataForm.reAdvise" type="textarea" maxlength="100" show-word-limit ></el-input>
        </el-form-item>
        
        <el-form-item label="指导内容" prop="advise" size="mini" >
          <el-input v-model="dataForm.reImfor" type="textarea" maxlength="500" show-word-limit></el-input>
        </el-form-item>
        <el-form-item label="指导收获" prop="advise" size="mini" >
          <el-input v-model="dataForm.reHarvest" type="textarea" maxlength="500" show-word-limit></el-input>
        </el-form-item>
        <el-form-item label="提交时间" prop="gmtCreate" size="mini">
          {{ dataForm.gmtCreate }}
          <!-- <el-input v-model="dataForm.gmtCreate" placeholder="职称"></el-input> -->
        </el-form-item>
        <el-form-item label="修改时间" prop="gmtCreate" size="mini">
          {{ dataForm.gmtModified }}
          <!-- <el-input v-model="dataForm.gmtCreate" placeholder="职称"></el-input> -->
        </el-form-item>
      </el-form>
  
      <span slot="footer" class="dialog-footer">
        <el-button icon="el-icon-upload" type="primary" @click="submitGuidance()">完成</el-button>
        <el-button type="primary" @click="visible = false">返回</el-button>
      </span>
    </el-dialog>
  </template>
  
  <script>
  import servicesApi from '@/services/servicesApi';
  export default {
    data() {
      return {
        visible: false,
        dataForm: {
            recordsId: '',
           name: '',
           username: '',
           state: '',
           reTeacher: '',
           reHarvest: '', 
           reAdvise: '', 
           reTarget: '', 
           department: '',
           stuSituation: '', 
           reImfor: '', 
           gmtCreate: '', 
           gmtModified: '',
           status: null
        },
  
      }
    },
    methods: {
      init(cgyId) {
        // console.log(cgyId)
        this.dataForm = cgyId
        this.visible = true
        // 当数据被修改后使用这个方法，会回调获取更新后的dom再渲染出来
        // this.$nextTick(() => {
        //   this.$refs['dataForm'].resetFields()
        // })
        // servicesApi.getFlagList().then(res => {
        //   if (res.data.code === 200) {
        //     this.stateList = res.data.data //获取身份列表：学生、教师、管理员
        //     this.visible = true
        //     this.$nextTick(() => {
        //       this.$refs['dataForm'].resetFields()
        //     })
        //   }
        // })
        // servicesApi.checkTdguidance(this.dataForm.recordsId).then(res => {
        //   let code = res.data.code
        //   let data = res.data.data
        //   // console.log('查询信息')
        //   if (code === 200) {
        //     // console.log(data)
        //     this.dataForm = data
        //   }
        // })  
      },
      submitGuidance() {
        servicesApi.changeGuidance(this.dataForm).then(res => {
            let code = res.data.code
            if (code === 200) {
                this.$message({
                    message: '提交成功',
                    type: 'success',
                    duration: 500,
                    onClose: () => {
                        this.getDataList()
                        this.activeName = null
                        this.dataForm = {}
                    }
                })
            } else {
                this.$message({
                    message: res.data.msg,
                    type: 'error',
                    duration: 500,
                    onClose: () => {
                        this.getDataList()
                        this.activeName = null
                        this.dataForm ={}
                    }
                })
            }
        })
        this.visible=false
    },
    }
  }
  </script>
  <style scoped>
  .el-form-item{
    font-size: larger;
    
  }
  .span{
    color: blueviolet;
  }
  </style>
  